<script>
    //show message if any
    var tTimeBack = 3;
    var id_of_setinterval;
    function runTimeBack(){
        $("#resultDiv").html('Redirect  ...');
        tTimeBack = tTimeBack-1;
        if (tTimeBack==-1)
        {
            id_of_setinterval = clearInterval(id_of_setinterval);
            window.location.href = '/game';
        }
    }
    var id_of_settimeout;
    <?php if(isset($result) && !empty($result)){?>

        id_of_settimeout = setTimeout(function(){
            id_of_settimeout = clearTimeout(id_of_settimeout);
            id_of_setinterval = window.setInterval(runTimeBack,300);
            },3000);
    <?php } ?>
</script>
<table cellspacing="0" cellpadding="0" width="100%">
<tbody>
<tr>
<td align="left" class='header' height="25px" > 
<a href="/" class="home" title="Home">&nbsp;Home</a>
<span class="mark">&nbsp;&raquo;&nbsp;</span> 
<span class="home">Change password</span> 
</td>
</tr>
</tbody>
</table>
<br/>

<?php
$baseUrl=base_url();	
?>

<?php

	echo form_open(base_url() . 'login/submitChangePassword','name="changePasswordForm"');    	
?>

<table width="100%" class="login" >
<tbody>
	<tr>
		<td id="heading" class="heading"  colspan="2">&there4;&nbsp;Change your password</td>
	</tr>
	<tr>
			<td class="resultText"  align="left"  colspan="2"><div id="resultDiv"><?php if(isset($result)){echo $result; } ?></div></td>
	</tr>		
	
	<tr>
		<td>&nbsp;</td>
	</tr>
	
	<tr>
		<td colspan="2">
		<?php if(isset($error) && !empty($error)) { ?>
			<div class="errorText"><?php echo $error ?> </div><div class="clearall"/>
		<?php }?>
		
		<?php echo validation_errors('<div class="errorText">', '</div>'); ?>
		</td>
	</tr>
	
	<tr>
		<td class="req"><span class="colortext">*</span>Current password:</td>
		<td style="height:30px;"><?php echo form_password('password', set_value('password'),'size="30" maxlength="50"'); ?></td>
	</tr>
	<tr>
		<td class="req"><span class="colortext">*</span>New password:</td>
		<td style="height:30px;"><?php echo form_password('newpassword', set_value('newpassword'),'size="30" maxlength="50"'); ?></td>
	</tr>
	<tr>
		<td class="req"><span class="colortext">*</span>Confirm new password:</td>
		<td style="height:30px;"><?php echo form_password('confirmnewpassword', set_value('confirmnewpassword'),'size="30" maxlength="50"'); ?></td>
	</tr>
	<tr>
		<td width="32%">&nbsp;</td>
		<td class="buttonRow">
			<a class="button"  href="javascript:submitChangePassword()">Change</a> &nbsp; 
			<a class="button"  href="/game">Cancel</a> 
		</td>
	</tr>
	<tr>
		<td colspan="2">&nbsp;</td>
		
	</tr>
</tbody>
</table>
 
<?php
	echo form_close();
?>

<script>
	 
	 var options = {   
            success: submitChangePasswordResponse  // post-submit callback 
    }; 
     
    // bind to the form's submit event 
    $('[name=changePasswordForm]').submit(function() { 
        $(this).ajaxSubmit(options);      
        return false; 
    });
    
</script>

		
